﻿/*
 * Erstellt mit SharpDevelop.
 * Benutzer: Kai Patrick
 * Datum: 04.04.2008
 * Zeit: 18:43
 * 
 * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
 */
 
using Gamadus.Engine;

partial class Game
{
	public static real neu1 = 0;
	public static real neu2 = 1;
	public static real neu3 = 0;
	public static real neu4 = 1;
	
	static void LoadSettings()
	{
		Engine.Instance.GameSettings[Setting.AllowESC] = true;
		Engine.Instance.GameSettings[Setting.AllowF4] = true;
		Engine.Instance.GameSettings[Setting.AllowCloseButton] = true;
		Engine.Instance.GameSettings[Setting.StartFullScreen] = false;
	}
	
	static void Setup()
	{
		Room rm;
		
		ResourceMgr.Instance.CreateObject(neu1, typeof(neu1));
		ResourceMgr.Instance.CreateObject(neu2, typeof(neu2));
		rm = ResourceMgr.Instance.CreateRoom(neu3);
		rm.bgcolor = System.Drawing.Color.FromArgb(255, 0, 0, 0);
		rm.persistent = false;
		rm.width = 640;
		rm.caption = "my room";
		rm.height = 480;
		rm.speed = 30;
		rm = ResourceMgr.Instance.CreateRoom(neu4);
		rm.bgcolor = System.Drawing.Color.FromArgb(255, 255, 0, 0);
		rm.persistent = false;
		rm.width = 400;
		rm.caption = "my second room";
		rm.height = 300;
		rm.speed = 60;
	}
	
	static void Populate(Room room)
	{
		if(room.ID == neu3)
		{
			ResourceMgr.Instance.CreateInstance(neu1,208,208,room);
		}
	}
}

class neu1 : ObjectSuper
{
	public neu1(int id, double x, double y, Room room) : base(id, x, y, room)
	{
		this.visible = true;
		this.depth = 0;
		this.persistent = false;
		Create();
	}
	
	protected override void __EventCreate()
	{
		Variable["inst"] = ResourceMgr.Instance.CreateInstance(Game.neu2, 0, 0);
		Variable["inst2"] = ResourceMgr.Instance.CreateInstance(Game.neu2, 0, 0);
	}
	
	protected override void __EventDraw()
	{
		ResourceMgr.Instance.GetObject(Game.neu2).Variable["x"] = 0;
		ResourceMgr.Instance.GetInstance(Variable["inst"]).Variable["x"] += 0.5;
	}
}

class neu2 : ObjectSuper
{
	public neu2(int id, double x, double y, Room room) : base(id, x, y, room)
	{
		this.visible = true;
		this.depth = 0;
		this.persistent = false;
		Create();
	}
	
	protected override void __EventCreate()
	{
		Variable["x"] = 0;
	}
	
	protected override void __EventDraw()
	{
		Gml.show_message(x);
	}
}